package com.hdu.other.oneDimensionPreInfo;

import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class newCoder1 {


    private static final int MAX_N = 100000;
    private static final int[] ARR = new int[MAX_N];
    private static final Map<Integer, Integer> PRE_SUM_TO_FIRST_INDEX = new HashMap<>();

    private static int N = 0;
    private static int K = 0;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        StreamTokenizer st = new StreamTokenizer(br);

        while (st.nextToken() != StreamTokenizer.TT_EOF) {
            N = (int) st.nval;
            PRE_SUM_TO_FIRST_INDEX.clear();
            st.nextToken();
            K = (int) st.nval;
            for (int i = 0; i < N; i++) {
                st.nextToken();
                ARR[i] = (int) st.nval;
            }
            pw.println(compute());
        }


        pw.flush();
        pw.close();
        br.close();
    }


    private static int compute() {
        PRE_SUM_TO_FIRST_INDEX.put(0, -1);
        int ans = 0;
        int curSum = 0;
        for (int i = 0; i < N; i++) {
            curSum += ARR[i];
            if (PRE_SUM_TO_FIRST_INDEX.containsKey(curSum - K)) {
                ans = Math.max(ans, i - PRE_SUM_TO_FIRST_INDEX.get(curSum - K));
            }
            PRE_SUM_TO_FIRST_INDEX.putIfAbsent(
                    curSum,
                    i
            );
        }
        return ans;
    }
}
